<template>
    <div>App
        <!-- 01.使用根模块的state的数据 -->
        <div>{{$store.state.username}}</div>
        <!-- 02.使用根模块的getters的数据 -->
        <p>{{ $store.getters.newName }}</p>
        <p>{{ $store.getters['newName'] }}</p>

    </div>
</template>
<script>
import { useStore } from 'vuex'
import { useRoute } from 'vue-router'
export default {
  name: 'App',
  setup (props, {}) {
    const store = useStore()
    console.log(useStore())
    const route = useRoute()
    console.log(route)
    // 提交跟模块的mutations函数
    // store.commit("updateName")

    // 调用根模块的actions函数
    store.dispatch('updateName')
  }
}
</script>
<style lang="less">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>
